class BedRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;

	BedRenderer(ITexture *texture) :
		Texture(texture)
	{
	}

	int GetTypeData(const int &data) { return data; }

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		renderer->Translate(8, 8, 8);
		switch (block.Data & ~(0x0C))
		{
		case 0:
			renderer->Rotate(270, 0, 1, 0);
			break;
		case 1:
			renderer->Rotate(180, 0, 1, 0);
			break;
		case 2:
			renderer->Rotate(90, 0, 1, 0);
			break;
		}
		renderer->Translate(-8, -8, -8);

		if ((block.Data & 0x08) == 0)
		{
			renderer->Draw(Face(Point3f(0, 7, 0), Point3f(16, 7, 0), Point3f(16, 7, 16), Point3f(0, 7, 16), Colorb::White, Texture, Point2i(6 * 16, 8 * 16 + 16), 16, -16));
			renderer->Draw(Face(Point3f(0, 7, 16), Point3f(16, 7, 16), Point3f(16, 16, 16), Point3f(0, 16, 16), Colorb::White, Texture, Point2i(6 * 16, (9 * 16) + 7), 16, 9));
			renderer->Draw(Face(Point3f(16, 7, 0), Point3f(0, 7, 0), Point3f(0, 16, 0), Point3f(16, 16, 0), Colorb::White, Texture, Point2i(6 * 16 + 16, (9 * 16) + 7), -16, 9));
			renderer->Draw(Face(Point3f(0, 7, 0), Point3f(0, 7, 16), Point3f(0, 16, 16), Point3f(0, 16, 0), Colorb::White, Texture, Point2i(5 * 16, (9 * 16) + 7), 16, 9));
		}
		else
		{
			renderer->Draw(Face(Point3f(0, 7, 0), Point3f(16, 7, 0), Point3f(16, 7, 16), Point3f(0, 7, 16), Colorb::White, Texture, Point2i(7 * 16, 8 * 16 + 16), 16, -16));
			renderer->Draw(Face(Point3f(0, 7, 16), Point3f(16, 7, 16), Point3f(16, 16, 16), Point3f(0, 16, 16), Colorb::White, Texture, Point2i(7 * 16, (9 * 16) + 7), 16, 9));
			renderer->Draw(Face(Point3f(16, 7, 0), Point3f(0, 7, 0), Point3f(0, 16, 0), Point3f(16, 16, 0), Colorb::White, Texture, Point2i(7 * 16 + 16, (9 * 16) + 7), -16, 9));
			renderer->Draw(Face(Point3f(16, 7, 16), Point3f(16, 7, 0), Point3f(16, 16, 0), Point3f(16, 16, 16), Colorb::White, Texture, Point2i(8 * 16, (9 * 16) + 7), 16, 9));
		}

		renderer->Draw(Face(Point3f(0, 13, 16), Point3f(16, 13, 16), Point3f(16, 13, 0), Point3f(0, 13, 0), Colorb::White, Texture, Point2i(4 * 16, 0), 16, 16));
	}
};